home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / kidplay / playwav.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1995-05-08  |  3.8 KB  |  131 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    Caption         =   "PLAYWAV"
  4.    ClientHeight    =   4530
  5.    ClientLeft      =   1065
  6.    ClientTop       =   1350
  7.    ClientWidth     =   11670
  8.    FontBold        =   -1  'True
  9.    FontItalic      =   0   'False
  10.    FontName        =   "MS Sans Serif"
  11.    FontSize        =   29.25
  12.    FontStrikethru  =   0   'False
  13.    FontUnderline   =   0   'False
  14.    Height          =   4935
  15.    Left            =   1005
  16.    LinkMode        =   1  'Source
  17.    LinkTopic       =   "Form1"
  18.    ScaleHeight     =   4530
  19.    ScaleWidth      =   11670
  20.    Top             =   1005
  21.    Width           =   11790
  22.    Begin TextBox Name2 
  23.       FontBold        =   -1  'True
  24.       FontItalic      =   0   'False
  25.       FontName        =   "MS Sans Serif"
  26.       FontSize        =   29.25
  27.       FontStrikethru  =   0   'False
  28.       FontUnderline   =   0   'False
  29.       Height          =   840
  30.       Left            =   4080
  31.       TabIndex        =   2
  32.       Top             =   3720
  33.       Width           =   7575
  34.    End
  35.    Begin TextBox Name1 
  36.       FontBold        =   -1  'True
  37.       FontItalic      =   0   'False
  38.       FontName        =   "MS Sans Serif"
  39.       FontSize        =   29.25
  40.       FontStrikethru  =   0   'False
  41.       FontUnderline   =   0   'False
  42.       Height          =   840
  43.       Left            =   0
  44.       TabIndex        =   1
  45.       Top             =   3720
  46.       Width           =   4095
  47.    End
  48.    Begin PictureBox Picture1 
  49.       Height          =   615
  50.       Index           =   0
  51.       Left            =   0
  52.       ScaleHeight     =   585
  53.       ScaleWidth      =   585
  54.       TabIndex        =   0
  55.       Top             =   0
  56.       Width           =   615
  57.    End
  58. Dim a$(114)
  59. Dim b$(500)
  60. Dim ActualIcons As Integer
  61. Sub Form_Load ()
  62.     vsize = Picture1(0).Height
  63.     hsize = Picture1(0).Width
  64.     Picture1(0).BackColor = RGB(Rnd(1) * 256, Rnd(1) * 256, Rnd(1) * 256)
  65.     For i = 1 To 113
  66.     ih = Int(i / 19)
  67.     il = i - ih * 19
  68.     Load Picture1(i)
  69.     Picture1(i).Top = ih * vsize
  70.     Picture1(i).left = il * hsize
  71.     Picture1(i).BackColor = RGB(Rnd(1) * 256, Rnd(1) * 256, Rnd(1) * 256)
  72.     Picture1(i).Visible = -1
  73.     Next i
  74. i = 0
  75.     Open "ICONS.DAT" For Input As #1 ' Open file for input.
  76.     Indx% = 0
  77.     Do While Not EOF(1) And Indx% <= 500    ' Check for end of file.
  78.     Input #1, b$(Indx%)  ' Read data.
  79.     Indx% = Indx% + 1   ' Increment index.
  80.     Loop
  81.     Close #1    ' Close data file.
  82.     ActualIcons = Indx%
  83.     Indx% = 0
  84.     Open "WAVS.DAT" For Input As #1 ' Open file for input.
  85.     Do While Not EOF(1) And Indx% <= 114    ' Check for end of file.
  86.     Input #1, a$(Indx%)  ' Read data.
  87.     Indx% = Indx% + 1   ' Increment index.
  88.     Loop
  89.     Close #1    ' Close data file.
  90.     ActualWavs = Indx%
  91. Rem if we have less than 114, use what we have to
  92. Rem fill the remaining entries.
  93.     If ActualWavs < 114 Then
  94.     For i = ActualWavs To 113
  95.     a$(i) = a$(i Mod ActualWavs)
  96.     Next i
  97.     End If
  98. End Sub
  99. Sub Picture1_Click (index As Integer)
  100. Rem make each series of icons different (yeah, there are better ways to do this...)
  101. For i = 1 To index
  102. j = Rnd(1)
  103. Next i
  104. j = Int(Rnd(1) * ActualIcons)
  105. s$ = b$(j)
  106. Rem drop the .ICO
  107. s$ = Left$(b$(j), Len(b$(j)) - 4)
  108. Rem drop the path, if there is one
  109. 500 For i = 1 To Len(s$)
  110.     If Mid$(s$, i, 1) = "\" Then
  111.     s$ = Mid$(s$, i + 1)
  112.     GoTo 500
  113.     End If
  114. Next i
  115. Picture1(index).Picture = LoadPicture(b$(j))
  116. Name2.Text = s$
  117. SoundName$ = a$(index)
  118. wFlag% = SND_ASYNC Or SND_NODEFAULT
  119. Rem drop the .WAV
  120. s$ = Left$(a$(index), Len(a$(index)) - 4)
  121. Rem drop the path, if there is one
  122. 50 For i = 1 To Len(s$)
  123.     If Mid$(s$, i, 1) = "\" Then
  124.     s$ = Mid$(s$, i + 1)
  125.     GoTo 50
  126.     End If
  127. Next i
  128. Name1.Text = s$
  129. x% = sndPlaySound(SoundName$, wFlag%)
  130. End Sub
  131.